package com.gill;

import com.gill.service.DemoService;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * step06：加载Spring配置，并调用远程服务
 *
 */
public class ConsumerApp {
    public static void main(String[] args) throws Exception {
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(new String[] {"spring-consumer.xml"});
        context.start();
        DemoService demoService = (DemoService)context.getBean("demoService"); // 获取远程服务代理
        String hello = demoService.sayHello("world"); // 执行远程方法
        System.out.println( hello ); // 显示调用结果
    }
}
